# -*- coding: utf-8 -*-
# @File     : routers.py
# @Author   : bingjia
# @Time     : 2020/7/30 16:07
# @Desc     : 路由

from operation.base.api import routers

router = routers.DefaultRouter(trailing_slash=False)

# auth
from operation.auth.api import AuthViewSet

router.register(r"auth", AuthViewSet, base_name="auth")

# users
from operation.users.api import UsersViewSet
from operation.users.api import UsersMessage
from operation.users.api import UserAdminViewSet

router.register(r"users", UsersViewSet, base_name="users")
router.register(r"users/message", UsersMessage, base_name="users-message")
router.register(r"admin/users", UserAdminViewSet, base_name="admin-users")

# leases
from operation.leases.api import LeaseViewSet
from operation.leases.api import LeaseModelViewSet
from operation.leases.api import LeaseServiceViewSet
from operation.leases.api import LeasePlatformViewSet
from operation.leases.api import LeaseModelAdminViewSet
from operation.leases.api import LeaseServiceAdminViewSet
from operation.leases.api import LeasePlatformAdminViewSet

router.register(r"leases", LeaseViewSet, base_name="leases")
router.register(r"lease/model", LeaseModelViewSet, base_name="lease-model")
router.register(r"lease/service", LeaseServiceViewSet, base_name="lease-service")
router.register(r"lease/platform", LeasePlatformViewSet, base_name="lease-platform")
router.register(r"admin/lease/model", LeaseModelAdminViewSet, base_name="admin-lease-model")
router.register(r"admin/lease/service", LeaseServiceAdminViewSet, base_name="admin-lease-service")
router.register(r"admin/lease/platform", LeasePlatformAdminViewSet, base_name="admin-lease-platform")

# project
from operation.projects.api import RoleViewSet
from operation.projects.api import ProjectViewSet
from operation.projects.api import MembershipViewSet
from operation.projects.api import ProjectAdminViewSet

router.register(r"projects", ProjectViewSet, base_name="projects")
router.register(r"admin/projects", ProjectAdminViewSet, base_name="admin-project")
router.register(r"project/(?P<resource_id>\d+)/roles", RoleViewSet, base_name="project-roles")
router.register(r"project/(?P<resource_id>\d+)/memberships", MembershipViewSet, base_name="project-memberships")

# checks
from operation.projects.checks.api import CheckViewSet
from operation.projects.checks.api import CheckAdminViewSet
from operation.projects.checks.api import CheckTypeAdminViewSet

router.register(r"project/(?P<resource_id>\d+)/checks", CheckViewSet, base_name="project-checks")
router.register(r"admin/checks", CheckAdminViewSet, base_name="admin-checks")
router.register(r"admin/checkTypes", CheckTypeAdminViewSet, base_name="admin-checkTypes")

# data
from operation.projects.datas.api import DataViewSet
from operation.projects.datas.api import DataAdminViewSet

router.register(r"project/(?P<resource_id>\d+)/datas", DataViewSet, base_name="project-datas")
router.register(r"admin/datas", DataAdminViewSet, base_name="admin-datas")

# equipment
from operation.projects.equipments.api import EquipmentViewSet
from operation.projects.equipments.api import EquipmentAdminViewSet

router.register(r"project/(?P<resource_id>\d+)/equipments", EquipmentViewSet, base_name="project-equipments")
router.register(r"admin/equipments", EquipmentAdminViewSet, base_name="admin-equipments")

# info
from operation.projects.infos.api import InfoViewSet
from operation.projects.infos.api import InfoAdminViewSet

router.register(r"project/(?P<resource_id>\d+)/infos", InfoViewSet, base_name="project-infos")
router.register(r"admin/infos", InfoAdminViewSet, base_name="admin-infos")

# train
from operation.trains.api import ModelAdminViewSet
from operation.trains.api import NetworkAdminViewSet

router.register(r"admin/trains/models", ModelAdminViewSet, base_name="admin-trains/models")
router.register(r"admin/trains/networks", NetworkAdminViewSet, base_name="admin-trains/networks")

# search
from operation.searches.api import SearchViewSet

router.register(r"searches", SearchViewSet, base_name="searches")

# stats
from operation.stats.api import SystemStatsViewSet

router.register(r"system/stats", SystemStatsViewSet, base_name="system-stats")

# timeline
from operation.timeline.api import TimelineViewSet

router.register(r"timeline", TimelineViewSet, base_name="timeline")
